import React from 'react';
import { Icon } from 'antd';
import { connect } from 'dva';
import  './ToggleButton.css';

const ToggleButton = React.createClass ({
  	leftShowHangdle(){
		this.props.dispatch({
	      type:'common/toggleLeftNav',
	      payload:this.props.common.iscollapsed
	    })
  	},
  	render(){
  		return(
  			<div className="leftToggle" onClick={this.leftShowHangdle}>
  				{
  					this.props.common.iscollapsed?
  					<Icon type="menu-unfold" />:
  					<Icon type="menu-fold" />
  				}
				
			</div>
  		)
  	}
})
function mapStateToProps({ common}) {
    return {common};
}
export default connect(mapStateToProps)(ToggleButton) ;
